<%@ page import="java.util.Date" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <link rel="stylesheet" href="../../static/common/layui/css/layui.css">
    <link rel="stylesheet" href="../../static/css/global.css">
    <link rel="stylesheet" href="../../static/css/table.css">
    <link rel="stylesheet" href="../../static/common/jquery-treetable/css/jquery.treetable.css" />
    <link rel="stylesheet" href="../../static/common/jquery-treetable/css/jquery.treetable.theme.default.css" />
    <style type="text/css">
        table{font-size:16px;}
        table.treetable thead tr th,table.treetable tbody tr td{padding:10px 1em;}
        table.treetable tbody tr td{border-top:1px solid #ccc;}
        table tr:hover{background:#F7F6A5 !important;}
        table td a.del{color:#f00;}
        table td a.add{color:green;}
    </style>
    <% long now = new Date().getTime();
        request.setAttribute("now", now); %>
</head>
<div style="margin: 15px;" id="Vue">
    <div v-show="show">
        <blockquote class="layui-elem-quote">
            <a href="#" class="layui-btn layui-btn-small" @click="addUniversity">
                <i class="layui-icon">&#xe608;</i> 创建学校
            </a>
            <a href="#" class="layui-btn layui-btn-small" @click="addSchool">
                <i class="layui-icon">&#xe608;</i> 创建学院
            </a>
        </blockquote>
        <fieldset class="layui-elem-field">
            <legend>院校信息</legend>
            <div class="layui-field-box layui-form">
                <table class="layui-table admin-table" id="example-basic">
                    <thead>
                    <tr>
                        <th>院校管理</th>
                        <th>地址/管理员</th>
                        <th>操作</th>
                    </tr>
                    </thead>
                    <%--内容容器--%>
                    <tbody id="content">
                    </tbody>
                </table>
            </div>
        </fieldset>

        <%--分页容器--%>
        <div class="admin-table-page">
            <div id="paged" class="page">
            </div>
        </div>
    </div>

    <!--显示学院管理员信息并可重置密码-->
    <div v-show="!show" style="display: none">
        <fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
            <legend>学院管理员信息</legend>
        </fieldset>
        <form class="layui-form" action="" method="post" onsubmit="return false;">
            <div class="layui-form-item">
                <label class="layui-form-label">姓名</label>
                <div class="layui-input-inline">
                    <input type="text" name="realname" class="layui-input" disabled>
                </div>
                <label class="layui-form-label">工号</label>
                <div class="layui-input-inline">
                    <input type="text" name="workid" class="layui-input" disabled>
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">性别</label>
                <div class="layui-input-inline">
                    <div v-if="">
                        <label class="layui-form-label" style="color: #999;text-align: center">男</label>
                    </div>
                    <div v-else="">
                        <label class="layui-form-label" style="color: #999;text-align: center">女</label>
                    </div>
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">手机</label>
                <div class="layui-input-inline">
                    <input type="tel" name="phone" class="layui-input" disabled>
                </div>
                <label class="layui-form-label">微信</label>
                <div class="layui-input-inline">
                    <input type="text" name="wechat" class="layui-input" disabled>
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">QQ</label>
                <div class="layui-input-inline">
                    <input type="text" name="qq" class="layui-input" disabled>
                </div>
                <label class="layui-form-label"><span style="color: red">*</span>电子邮箱</label>
                <div class="layui-input-inline">
                    <input type="text" name="email" autocomplete="off" class="layui-input" disabled>
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-input-block">
                    <button class="layui-btn" @click="changePwd">重置密码</button>
                    <input type="button" class="layui-btn" @click="reload" value="返回">
                </div>
            </div>
        </form>
    </div>
</div>
<!--模板-->
<script type="text/html" id="tpl">
    {{# layui.each(d.data, function(index, item){ }}
    {{# if (item.schoolList.length == 0){ }}
    <tr data-node-id="{{item.university.id}}">
        <td>{{ item.university.name }}</td>
        <td>N/A</td>
        <td><a href="#" class="layui-btn layui-btn-mini" @click="addSchool">
            创建学院
        </a></td>
    <tr>
        {{# } }}
        {{# if (item.schoolList.length != 0){ }}
    <tr data-node-id="{{item.university.id}}">
        <td>{{ item.university.name }}</td>
        {{# if (item.area == null){ }}
        <td>{{"null" }}</td>
        {{# } }}
        {{# if (item.area != null){ }}
        <td>{{item.area.Province_name }}/{{item.area.City_name }}/{{item.area.District_name }}</td>
        {{# } }}
        <td> <a href="javascript:;" target="_self" data-id="{{item.university.id}}" data-opt="more"
                class="layui-btn layui-btn-normal layui-btn-mini" style="background-color: #009688;">创建学院</a></td>

    <tr>
        {{# } }}
        {{# layui.each(item.schoolList, function(index, school){ }}
        {{#console.log("item.schoolList"+item.schoolList);}}
    <tr data-node-id=""  data-parent-id="{{item.university.id}}" >
        <td>{{ school.name }}</td>
        <td>{{school.schoolManagerInfo ||"null"}}</td>
        <td> <a href="javascript:;" target="_self" data-id="{{school.id}}" data-opt="delete"
                class="layui-btn layui-btn-normal layui-btn-mini" >删除学院</a>
    </tr>
    {{# }); }}
    {{# }); }}
</script>
<script src="../../static/common/axios.min.js"></script>
<script src="../../static/common/vue.min.js"></script>
<script src="../../static/common/layui/layui.js"></script>
<script src="../../static/js/system/univerysityAndSchool.js"></script>
<script type="text/javascript" src="../../static/common/jquery/jquery-1.11.1.min.js"></script>
<script type="text/javascript" src="../../static/common/jquery-treetable/jquery.treetable.js"></script>
</body>
</html>
